package org.gap.domain;

import java.io.Serializable;

import java.lang.StringBuilder;

import java.util.LinkedHashSet;
import java.util.Set;

import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;

import javax.xml.bind.annotation.*;

import javax.persistence.*;

/**
 */

@Entity
@NamedQueries({
		@NamedQuery(name = "findAllUtilisateurss", query = "select myUtilisateurs from Utilisateurs myUtilisateurs"),
		@NamedQuery(name = "findUtilisateursByPrimaryKey", query = "select myUtilisateurs from Utilisateurs myUtilisateurs where myUtilisateurs.usrUser = ?1"),
		@NamedQuery(name = "findUtilisateursByUsrEnabled", query = "select myUtilisateurs from Utilisateurs myUtilisateurs where myUtilisateurs.usrEnabled = ?1"),
		@NamedQuery(name = "findUtilisateursByUsrMail", query = "select myUtilisateurs from Utilisateurs myUtilisateurs where myUtilisateurs.usrMail = ?1"),
		@NamedQuery(name = "findUtilisateursByUsrMailContaining", query = "select myUtilisateurs from Utilisateurs myUtilisateurs where myUtilisateurs.usrMail like ?1"),
		@NamedQuery(name = "findUtilisateursByUsrPassword", query = "select myUtilisateurs from Utilisateurs myUtilisateurs where myUtilisateurs.usrPassword = ?1"),
		@NamedQuery(name = "findUtilisateursByUsrPasswordContaining", query = "select myUtilisateurs from Utilisateurs myUtilisateurs where myUtilisateurs.usrPassword like ?1"),
		@NamedQuery(name = "findUtilisateursByUsrService", query = "select myUtilisateurs from Utilisateurs myUtilisateurs where myUtilisateurs.usrService = ?1"),
		@NamedQuery(name = "findUtilisateursByUsrServiceContaining", query = "select myUtilisateurs from Utilisateurs myUtilisateurs where myUtilisateurs.usrService like ?1"),
		@NamedQuery(name = "findUtilisateursByUsrUser", query = "select myUtilisateurs from Utilisateurs myUtilisateurs where myUtilisateurs.usrUser = ?1"),
		@NamedQuery(name = "findUtilisateursByUsrUserContaining", query = "select myUtilisateurs from Utilisateurs myUtilisateurs where myUtilisateurs.usrUser like ?1") })
@Table(schema = "GAP", name = "UTILISATEURS")
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(namespace = "GAP_v2/org/gap/domain", name = "Utilisateurs")
@XmlRootElement(namespace = "GAP_v2/org/gap/domain")
public class Utilisateurs implements Serializable {
	private static final long serialVersionUID = 1L;

	/**
	 */

	@Column(name = "USR_USER", length = 10, nullable = false)
	@Basic(fetch = FetchType.EAGER)
	@Id
	@XmlElement
	String usrUser;
	/**
	 */

	@Column(name = "USR_PASSWORD", length = 100, nullable = false)
	@Basic(fetch = FetchType.EAGER)
	@XmlElement
	String usrPassword;
	/**
	 */

	@Column(name = "USR_SERVICE", length = 6)
	@Basic(fetch = FetchType.EAGER)
	@XmlElement
	String usrService;
	/**
	 */

	@Column(name = "USR_MAIL", length = 100)
	@Basic(fetch = FetchType.EAGER)
	@XmlElement
	String usrMail;
	/**
	 */

	@Column(name = "USR_ENABLED", nullable = false)
	@Basic(fetch = FetchType.EAGER)
	@XmlElement
	Boolean usrEnabled;

	/**
	 */
	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumns({ @JoinColumn(name = "USR_TIERS", referencedColumnName = "TIE_TIERS", nullable = false) })
	@XmlTransient
	Tiers tiers;
	/**
	 */
	@OneToMany(mappedBy = "utilisateursByTrbUserCreation", cascade = { CascadeType.REMOVE }, fetch = FetchType.LAZY)
	@XmlElement(name = "", namespace = "")
	java.util.Set<org.gap.domain.TiersRib> tiersRibsForTrbUserCreation;
	/**
	 */
	@OneToMany(mappedBy = "utilisateurs", cascade = { CascadeType.REMOVE }, fetch = FetchType.LAZY)
	@XmlElement(name = "", namespace = "")
	java.util.Set<org.gap.domain.UtilisateursGroupe> utilisateursGroupes;
	/**
	 */
	@OneToMany(mappedBy = "utilisateursByAddUserModification", cascade = { CascadeType.REMOVE }, fetch = FetchType.LAZY)
	@XmlElement(name = "", namespace = "")
	java.util.Set<org.gap.domain.Adresses> adressesesForAddUserCreation;
	/**
	 */
	@OneToMany(mappedBy = "utilisateursByAdtUserModification", cascade = { CascadeType.REMOVE }, fetch = FetchType.LAZY)
	@XmlElement(name = "", namespace = "")
	java.util.Set<org.gap.domain.AdressesTiers> adressesTiersesForAdtUserCreation;
	/**
	 */
	@OneToMany(mappedBy = "utilisateurs", cascade = { CascadeType.REMOVE }, fetch = FetchType.LAZY)
	@XmlElement(name = "", namespace = "")
	java.util.Set<org.gap.domain.TiersModif> tiersModifs;
	/**
	 */
	@OneToMany(mappedBy = "utilisateursByAdtUserModification", cascade = { CascadeType.REMOVE }, fetch = FetchType.LAZY)
	@XmlElement(name = "", namespace = "")
	java.util.Set<org.gap.domain.AdressesTiers> adressesTiersesForAdtUserModification;
	/**
	 */
	@OneToMany(mappedBy = "utilisateursByAddUserModification", cascade = { CascadeType.REMOVE }, fetch = FetchType.LAZY)
	@XmlElement(name = "", namespace = "")
	java.util.Set<org.gap.domain.Adresses> adressesesForAddUserModification;
	/**
	 */
	@OneToMany(mappedBy = "utilisateursByTrbUserCreation", cascade = { CascadeType.REMOVE }, fetch = FetchType.LAZY)
	@XmlElement(name = "", namespace = "")
	java.util.Set<org.gap.domain.TiersRib> tiersRibsForTrbUserModification;

	/**
	 */
	public void setUsrUser(String usrUser) {
		this.usrUser = usrUser;
	}

	/**
	 */
	public String getUsrUser() {
		return this.usrUser;
	}

	/**
	 */
	public void setUsrPassword(String usrPassword) {
		this.usrPassword = usrPassword;
	}

	/**
	 */
	public String getUsrPassword() {
		return this.usrPassword;
	}

	/**
	 */
	public void setUsrService(String usrService) {
		this.usrService = usrService;
	}

	/**
	 */
	public String getUsrService() {
		return this.usrService;
	}

	/**
	 */
	public void setUsrMail(String usrMail) {
		this.usrMail = usrMail;
	}

	/**
	 */
	public String getUsrMail() {
		return this.usrMail;
	}

	/**
	 */
	public void setUsrEnabled(Boolean usrEnabled) {
		this.usrEnabled = usrEnabled;
	}

	/**
	 */
	public Boolean getUsrEnabled() {
		return this.usrEnabled;
	}

	/**
	 */
	public void setTiers(Tiers tiers) {
		this.tiers = tiers;
	}

	/**
	 */
	public Tiers getTiers() {
		return tiers;
	}

	/**
	 */
	public void setTiersRibsForTrbUserCreation(Set<TiersRib> tiersRibsForTrbUserCreation) {
		this.tiersRibsForTrbUserCreation = tiersRibsForTrbUserCreation;
	}

	/**
	 */
	public Set<TiersRib> getTiersRibsForTrbUserCreation() {
		if (tiersRibsForTrbUserCreation == null) {
			tiersRibsForTrbUserCreation = new java.util.LinkedHashSet<org.gap.domain.TiersRib>();
		}
		return tiersRibsForTrbUserCreation;
	}

	/**
	 */
	public void setUtilisateursGroupes(Set<UtilisateursGroupe> utilisateursGroupes) {
		this.utilisateursGroupes = utilisateursGroupes;
	}

	/**
	 */
	public Set<UtilisateursGroupe> getUtilisateursGroupes() {
		if (utilisateursGroupes == null) {
			utilisateursGroupes = new java.util.LinkedHashSet<org.gap.domain.UtilisateursGroupe>();
		}
		return utilisateursGroupes;
	}

	/**
	 */
	public void setAdressesesForAddUserCreation(Set<Adresses> adressesesForAddUserCreation) {
		this.adressesesForAddUserCreation = adressesesForAddUserCreation;
	}

	/**
	 */
	public Set<Adresses> getAdressesesForAddUserCreation() {
		if (adressesesForAddUserCreation == null) {
			adressesesForAddUserCreation = new java.util.LinkedHashSet<org.gap.domain.Adresses>();
		}
		return adressesesForAddUserCreation;
	}

	/**
	 */
	public void setAdressesTiersesForAdtUserCreation(Set<AdressesTiers> adressesTiersesForAdtUserCreation) {
		this.adressesTiersesForAdtUserCreation = adressesTiersesForAdtUserCreation;
	}

	/**
	 */
	public Set<AdressesTiers> getAdressesTiersesForAdtUserCreation() {
		if (adressesTiersesForAdtUserCreation == null) {
			adressesTiersesForAdtUserCreation = new java.util.LinkedHashSet<org.gap.domain.AdressesTiers>();
		}
		return adressesTiersesForAdtUserCreation;
	}

	/**
	 */
	public void setTiersModifs(Set<TiersModif> tiersModifs) {
		this.tiersModifs = tiersModifs;
	}

	/**
	 */
	public Set<TiersModif> getTiersModifs() {
		if (tiersModifs == null) {
			tiersModifs = new java.util.LinkedHashSet<org.gap.domain.TiersModif>();
		}
		return tiersModifs;
	}

	/**
	 */
	public void setAdressesTiersesForAdtUserModification(Set<AdressesTiers> adressesTiersesForAdtUserModification) {
		this.adressesTiersesForAdtUserModification = adressesTiersesForAdtUserModification;
	}

	/**
	 */
	public Set<AdressesTiers> getAdressesTiersesForAdtUserModification() {
		if (adressesTiersesForAdtUserModification == null) {
			adressesTiersesForAdtUserModification = new java.util.LinkedHashSet<org.gap.domain.AdressesTiers>();
		}
		return adressesTiersesForAdtUserModification;
	}

	/**
	 */
	public void setAdressesesForAddUserModification(Set<Adresses> adressesesForAddUserModification) {
		this.adressesesForAddUserModification = adressesesForAddUserModification;
	}

	/**
	 */
	public Set<Adresses> getAdressesesForAddUserModification() {
		if (adressesesForAddUserModification == null) {
			adressesesForAddUserModification = new java.util.LinkedHashSet<org.gap.domain.Adresses>();
		}
		return adressesesForAddUserModification;
	}

	/**
	 */
	public void setTiersRibsForTrbUserModification(Set<TiersRib> tiersRibsForTrbUserModification) {
		this.tiersRibsForTrbUserModification = tiersRibsForTrbUserModification;
	}

	/**
	 */
	public Set<TiersRib> getTiersRibsForTrbUserModification() {
		if (tiersRibsForTrbUserModification == null) {
			tiersRibsForTrbUserModification = new java.util.LinkedHashSet<org.gap.domain.TiersRib>();
		}
		return tiersRibsForTrbUserModification;
	}

	/**
	 */
	public Utilisateurs() {
	}

	/**
	 * Copies the contents of the specified bean into this bean.
	 *
	 */
	public void copy(Utilisateurs that) {
		setUsrUser(that.getUsrUser());
		setUsrPassword(that.getUsrPassword());
		setUsrService(that.getUsrService());
		setUsrMail(that.getUsrMail());
		setUsrEnabled(that.getUsrEnabled());
		setTiers(that.getTiers());
		setTiersRibsForTrbUserCreation(new java.util.LinkedHashSet<org.gap.domain.TiersRib>(that.getTiersRibsForTrbUserCreation()));
		setUtilisateursGroupes(new java.util.LinkedHashSet<org.gap.domain.UtilisateursGroupe>(that.getUtilisateursGroupes()));
		setAdressesesForAddUserCreation(new java.util.LinkedHashSet<org.gap.domain.Adresses>(that.getAdressesesForAddUserCreation()));
		setAdressesTiersesForAdtUserCreation(new java.util.LinkedHashSet<org.gap.domain.AdressesTiers>(that.getAdressesTiersesForAdtUserCreation()));
		setTiersModifs(new java.util.LinkedHashSet<org.gap.domain.TiersModif>(that.getTiersModifs()));
		setAdressesTiersesForAdtUserModification(new java.util.LinkedHashSet<org.gap.domain.AdressesTiers>(that.getAdressesTiersesForAdtUserModification()));
		setAdressesesForAddUserModification(new java.util.LinkedHashSet<org.gap.domain.Adresses>(that.getAdressesesForAddUserModification()));
		setTiersRibsForTrbUserModification(new java.util.LinkedHashSet<org.gap.domain.TiersRib>(that.getTiersRibsForTrbUserModification()));
	}

	/**
	 * Returns a textual representation of a bean.
	 *
	 */
	public String toString() {

		StringBuilder buffer = new StringBuilder();

		buffer.append("usrUser=[").append(usrUser).append("] ");
		buffer.append("usrPassword=[").append(usrPassword).append("] ");
		buffer.append("usrService=[").append(usrService).append("] ");
		buffer.append("usrMail=[").append(usrMail).append("] ");
		buffer.append("usrEnabled=[").append(usrEnabled).append("] ");

		return buffer.toString();
	}

	/**
	 */
	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = (int) (prime * result + ((usrUser == null) ? 0 : usrUser.hashCode()));
		return result;
	}

	/**
	 */
	public boolean equals(Object obj) {
		if (obj == this)
			return true;
		if (!(obj instanceof Utilisateurs))
			return false;
		Utilisateurs equalCheck = (Utilisateurs) obj;
		if ((usrUser == null && equalCheck.usrUser != null) || (usrUser != null && equalCheck.usrUser == null))
			return false;
		if (usrUser != null && !usrUser.equals(equalCheck.usrUser))
			return false;
		return true;
	}
}
